package what.basic.swingcommon;
import what.basic.basiccomponent.*;
import javax.swing.*;
import javax.swing.border.Border;

import java.awt.*;
public class swingborder {
	JFrame f =new Jframe().jframe("border factory", 300, 400, true);
	public void noborderpane(){
		JPanel jp=new JPanel();
		f.setContentPane(jp);
	}
	public void lineborderpane(){
		JPanel jp=new JPanel();
		f.setContentPane(jp);
		jp.setBorder(BorderFactory.createLineBorder(Color.red));
		JButton b1=new JButton("dssdd");
		Border bo2=BorderFactory.createLineBorder(Color.blue);
		Border bo1=BorderFactory.createTitledBorder("title");
		Border bo3=BorderFactory.createTitledBorder(bo2,"title");
		jp.add(b1);
		RedLineBorder or=new RedLineBorder();
		b1.setBorder(or);
	}
	public static void main(String[] args) {
		new swingborder().noborderpane();
		new swingborder().lineborderpane();

	}

}
class RedLineBorder implements Border{
	public Insets getBorderInsets(Component c) {
	return new Insets(10,10,10,10);
	}
	public boolean isBorderOpaque() {
		return false;
	}
	public void paintBorder(Component c, Graphics g, int x, int y, int width,
			int height) {
		g.setColor(Color.orange
			);
		g.drawRect(x, y, width, height);
	}
	
}